﻿using Pattern24解释器模式.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pattern24解释器模式.Models
{
    /// <summary>
    /// 解释方向的表达式
    /// </summary>
    public class DirectionExpression : Expression
    {
        private string content;

        public DirectionExpression(string content)
        {
            this.content = content;
        }

        public override string Interpret()
        {
            if (this.content == "up")
            {
                return "向上";
            }
            else if (content == "down")
            {
                return "向下";
            }
            else if(content == "left")
            {
                return "向左";
            }
            else if(this.content == "right")
            {
                return "向右";
            }
            else
            {
                return "方向错误";
            }
        }
    }
}
